package com.example.mvvm.base.livedata;

import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.Observer;

/**
 * Time: 5/7/2021 16:18
 * Author: TAO
 * Description:
 */
public class StatusLiveEvent extends SingleLiveEvent<Integer> {

    public void observe(@NonNull LifecycleOwner owner, StatusObserver observer) {
        super.observe(owner, observer::onStatusChanged);
    }

    public interface StatusObserver {

        void onStatusChanged(@Status int status);
    }

    public @interface Status {
        int LOADING = 0;
        int SUCCESS = 1;
        int FAILURE = 2;
        int ERROR = 3;
    }
}
